<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // search(接受字符串或者正则)   返回下标
        // split(接受字符串或者正则)  切割成数组


        // match()  找到匹配的元素，返回的是数组   默认只匹配一个(一般需要加全局匹配g)

        // replace()   默认只替换一个(一般需要加全局匹配g)


        var res = 'hello'.search(/o/) ;
        console.log(res);


        var str = 'day   daAy  up' ;
        // console.log(str.split(/ +/));  


        var arr = str.match(/da+y/ig) ;
        console.log(arr);




    </script>
    
</body>
</html>